import { createApp } from "vue";
import "./styles/global.scss"; // 全局样式
import { createPinia } from "pinia";
import "element-plus/dist/index.css"; // element-plus样式丢失
import piniaPluginPersistedstate from "pinia-plugin-persistedstate";
import router from "./router";
import App from "./App.vue";
import * as directive from "./directive";
import './utils/initTheme' // 初始化主题
import i18n from './language/index' // 国际化
import componentsArr from "./components/global.js";
const pinia = createPinia();
pinia.use(piniaPluginPersistedstate); // 数据持久化
const app = createApp(App);
app.use(pinia);
app.use(router);
app.use(i18n)

// 全局公共组件 注册
componentsArr.forEach(item => {
  app.component(item.__name, item);
});

// 自定义指令
for (let i in directive) {
  app.directive(i, directive[i]);
}

app.mount("#app");
